package com.yueya.basic.role.model;

import java.util.List;

import com.jfinal.aop.Duang;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.yueya.basic.role.service.RoleMenuService;

@SuppressWarnings("serial")
public class RoleMenu extends Model<RoleMenu> {
	public static final RoleMenu dao = new RoleMenu();

	public static RoleMenuService service = Duang.duang(RoleMenuService.class);

	public List<RoleMenu> getListByRoleId(String roleid) {

		String sql = "select * from t_role_menu where role_id=?";
		List<RoleMenu> li = RoleMenu.dao.find(sql, roleid);

		return li;
	}

	/**
	 * 通过roleid删除
	 * 
	 * @param role_id
	 */
	public boolean deleteByRoleId(String roleid) {
		boolean bl = false;
		if (roleid != null) {
			int num = Db.update("delete from t_role_menu where role_id=?", roleid);
			if (num > 0) {
				bl = true;
			}
		}
		return bl;
	}
}
